<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>绑定style样式</title>
  <script src="../../js/vue.js"></script>
  <style>
    .basic{
      width: 400px;
      height: 100px;
      border: 1px solid black;
    }

  </style>


</head>
<body>
<div id="root">
  <!-- 绑定style样式--对象写法 -->
  <div class="basic" :style="styleObj1">{{name}}</div> <br/><br/>
</div>

<script>
  Vue.config.productionTip = false

  const vm = new Vue({
    el:'#root',

    data: {
      name: '曾宇杰',
      styleObj1: {
        fontSize: '40px',
        color: 'red',
        backgroundColor: 'gray'
      },
      styleObj2: {
        backgroundColor: 'orange'
      },
    }

  })
</script>


</body>
</html>